package com.spring.hed.factory.abstracts;

public class Order {

    AbsFactory factory;

    public Order(AbsFactory factory,String type) {
        setFactory(factory,type);

    }

    private void setFactory(AbsFactory factory,String type) {
        this.factory = factory;
        Pizza pizza  = factory.createPizza(type);
        if (pizza != null){
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        }else {
            System.out.println("创建失败！");
        }
    }
}
